package cn.tj.mapper;

import cn.tj.entity.Technician;
import cn.tj.service.TechnicianService;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TechnicianMapper {
    /**
     * 条件分页查询技师列表
     * @param typeId
     * @param name
     * @return
     */
    List<Technician> listByPage(Integer typeId, String name);

    /**
     * 通过id获取技师信息
     * @param id
     * @return
     */
    @Select("select * from technician " +
            "where id=#{id} ")
    Technician getById(Integer id);

    /**
     * 通过id修改技师信息
     * @param technician
     */
    @Update("update technician set " +
            "type_id=#{typeId},name=#{name} " +
            "where id=#{id} ")
    void editById(Technician technician);

    /**
     * 新增信息
     * @param technician
     */
    @Insert("insert into technician values " +
            "(null,#{typeId},#{name},default,default)")
    void add(Technician technician);

    /**
     * 根据id删除信息
     * @param id
     */
    @Delete("delete from technician " +
            "where id=#{id}")
    void deleteById(Integer id);
}
